package Month11.Day10;

import java.util.Arrays;
import java.util.Scanner;

public class T3 {
    public static void main(String[] args) {
        String a = "zip";
        String b = "rar";
        Scanner in = new Scanner(System.in);
        System.out.println("请输入你的作业（带格式）");
        String work = in.next();
        String[] s = work.split("\\.");
        if (s.length>2){
            System.out.println("输入有问题，请重新输入！");
           return;
        }
        boolean geshi = false;
        for (int i = 0; i < s.length; i++) {
            System.out.println(s[i]);
            if (a.equals(s[i]) || b.equals(s[i])) {
                geshi = true;

            }
        }
        if (geshi) {
            System.out.println("作业格式合适!");
        } else {
            System.out.println("作业格式不合适，请重新输入！");
            return;
        }
        String s1 = "";
        for (int i = 0; i < s.length; i++) {
            s1 = s[0];
        }
        byte[] a1 = s1.getBytes();
        System.out.println(Arrays.toString(a1));
        boolean user = false;

        for (int i = 0; i < a1.length; i++) {
            if (a1[i] < 0) {
                user = true;
            }else {
                System.out.println("用户名格式不正确，请重新输入！");
                return;
            }
        }
        if (user) {
            System.out.println("用户名格式正确");
        }

    }
}

